local Lua__shuangfeng = fk.CreateSkill {
  name = "Lua__shuangfeng",
  tags = { Skill.Combo }
}

Fk:loadTranslationTable {
  ["Lua__shuangfeng"] = "霜风",
  ["$Lua__shuangfeng1"] = "朔风起，永结寒冰的时候到了。",
  ["$Lua__shuangfeng2"] = "汇源寒冰，朔风凌冽。",
  ["$Lua__shuangfeng3"] = "清寒不喜争抢，但更害怕抢不到。",
  ["Lua__shuangfengSlash"] = "霜风",
  ["#Lua__shuangfengSlash-use"] = "霜风：你可以使用一张无次数与距离限制的【冰杀】。",
  [":Lua__shuangfeng"] = "连招技（失去手牌+获得手牌），你视为使用一张不计算距离与次数限制的【冰杀】。当有玩家响应你的牌后，你对其造成一点冰属性伤害。",
  ["@@shuangfeng"] = "连招→<font color='red'>获得手牌</font>",
}

Lua__shuangfeng:addEffect(fk.AfterCardsMove, {
  anim_type = "offensive",
  can_trigger = function(self, event, target, player, data)
    if player:hasSkill(Lua__shuangfeng.name) then
      for _, move in ipairs(data) do
        if move.to and move.to == player and player:getMark("@@shuangfeng") == 1 and move.toArea == Card.PlayerHand then
          return true
        end
      end
    end
  end,
  on_cost = function(self, event, target, player, data)
    local room = player.room
    local use = room:askToUseVirtualCard(player, {
      name = "ice__slash",
      skill_name = Lua__shuangfeng.name,
      prompt = "#Lua__shuangfengSlash-use",
      cancelable = true,
      skip = true,
    })
    room:setPlayerMark(player, "@@shuangfeng", 0)

    if use then
      event:setCostData(self, { extra_data = use })
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    player.room:useCard(event:getCostData(self).extra_data)
  end,
})
Lua__shuangfeng:addEffect(fk.CardEffectCancelledOut, {
  anim_type = "offensive",
  is_delay_effect = true,
  can_trigger = function(self, event, target, player, data)
    if player:hasSkill(Lua__shuangfeng.name) then
      return target == player
    end
  end,
  on_use = function(self, event, target, player, data)
    local to = data.to
    player.room:damage({
      from = player,
      to = to,
      damage = 1,
      damageType = fk.IceDamage,
      skillName = Lua__shuangfeng.name
    })
  end,
})
Lua__shuangfeng:addEffect(fk.AfterCardsMove, {
  can_refresh = function(self, event, target, player, data)
    if player:hasSkill(self, true) then
      for _, move in ipairs(data) do
        if move.from and move.from == player then
          for _, info in ipairs(move.moveInfo) do
            if info.fromArea == Card.PlayerHand then
              return true
            end
          end
        end
      end
    end
  end,
  on_refresh = function(self, event, target, player, data)
    local room = player.room
    room:setPlayerMark(player, "@@shuangfeng", 1)
  end,
})

return Lua__shuangfeng
